# RUN: %as %s -o %t.o
# RUN: %objdump -d %t.o | tail -n +6 > %t.txt
# RUN: diff %t.txt %S/../expected/ctrl_NOP_NOP_2.txt
.global start
_begin:
start:

.text
#.section .vector

#.ent main

.exptable:
jmp  exp_lable0||         #bus error 0
nop||
nop||
nop||

jmp  exp_lable1||         #bus error 1
nop||
nop||
nop||

jmp  exp_lable2||        #bus error 2
nop||
nop||
nop||

jmp  exp_lable3||         #bus error 3
nop||
nop||
nop||

jmp  exp_lable4||         #exception illegale instruction
nop||
nop||
nop||

jmp  exp_lable5||         #exception overflow
nop||
nop||
nop||

jmp  exp_lable6||         # exception illegale address
nop||
nop||
nop||

jmp  exp_lable7||          # exception 3
nop||
nop||
nop||

jmp  exp_lable8||          #unavoided pic 0
nop||
nop||
nop||

jmp  exp_lable9||          #unavoided pic 1 (wathc dog)
nop||
nop||
nop||

jmp  exp_lablea||          #inner pic 2
nop||
nop||
nop||

jmp  exp_lableb||           #timer pic
nop||
nop||
nop||

jmp  exp_lablec||           # outer pic 4
nop||
nop||
nop||

jmp  exp_labled||          # outer pic 5
nop||
nop||
nop||

jmp  exp_lablee||          # outer pic 6
nop||
nop||
nop||

jmp  exp_lablef||          # outer pic 7
nop||
nop||
nop||

exp_lable0:
movigl GR0 0||
rtt||
nop||
nop||

exp_lable1:
movigl GR0 1||
rtt||
nop||
nop||

exp_lable2:
movigl GR0 1||
rtt||
nop||
nop||

exp_lable3:
movigl GR0 3||
rtt||
nop||
nop||

exp_lable4:
movigl GR0 4||
rtt||
nop||
nop||

exp_lable5:
movigl GR0 5||
rtt||
nop||
nop||

exp_lable6:
movigl GR0 6||
rtt||
nop||
nop||

exp_lable7:
movigl GR0 7||
rtt||
nop||
nop||

exp_lable8:
movigl GR0 8||
rtt||
nop||
nop||

exp_lable9:
movigl GR0 9||
rtt||
nop||
nop||

exp_lablea:
movigl GR0 10||
rtt||
nop||
nop||

exp_lableb:
movigl GR0 11||
rtt||
nop||
nop||

exp_lablec:
movigl GR0 12||
rtt||
nop||
nop||

exp_labled:
movigl GR0 13||
rtt||
nop||
nop||

exp_lablee:
movigl GR0 14||
rtt||
nop||
nop||

exp_lablef:
movigl GR0 15||
rtt||
nop||
nop||

boot:
.=1024
main:
#.section .qxinit
movigh GR1 0x0000|| # load address
movigl GR1 0x0010|| 
movigh GR2 0x0000|| # load target
movigl GR2 0x0000|| 
movigh GR3 0x0000|| # store address
movigl GR3 0x0020|| 
movigh GR4 0xa5a5|| # store data
movigl GR4 0xa5a5|| 
movigh GR5 0x5a5a|| # load data
movigl GR5 0x5a5a|| 
movigh GR6 0x0000|| # store target
movigl GR6 0x0000|| 
||store32 GR4 GR1 0x0
nop||
nop|| 
nop||

call label1||
nop||
nop||
nop||

movigh GR7 0x0000||
movigl GR7 0x0000||
movigh GR8 0x0000||
movigl GR8 0x0000||
call label1|load32 GR6 GR1 0x0|store32 GR5 GR1 0x0
nop||
nop||
nop||
|load32 GR9 GR1 0x0|

movigh GR7 0x0000||
movigl GR7 0x0000||
movigh GR8 0x0000||
movigl GR8 0x0000||
call label1|load32 GR10 GR1 0x0|

movigh GR7 0x0000||
movigl GR7 0x0000||
movigh GR8 0x0000||
movigl GR8 0x0000||
call label1||store32 GR9 GR2 0x0
|load32 GR1 GR2 0x0|

myloop:
nop|nop|nop
nop|nop|nop
nop|nop|nop
nop|nop|nop
jmp myloop||
nop|nop|nop
nop|nop|nop
nop|nop|nop
nop|nop|nop

label1:
movigh GR7 0x0007||
movigl GR7 0x0007||
movigh GR8 0x0008||
movigl GR8 0x0008||
ret||
nop||
nop||
nop||


